/******************************************************************************/

package jamie.org.sil.www.usxConverter;

import java.io.*;

import jamie.org.sil.www.usxUtils.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Stack;


/******************************************************************************/
/**
   ODT conversions.
   <p>

   Note that output goes to a standard folder structure and includes some
   standard files.  We assume that all of these are already in place, and
   therefore do not need to be generated.

   @author ARA "Jamie" Jamieson
*/

public class UsxConverterToOdt extends UsxConverterTo
{
  /****************************************************************************/
  /****************************************************************************/
  /**                                                                        **/
  /**                                 Public                                 **/
  /**                                                                        **/
  /****************************************************************************/
  /****************************************************************************/

  /****************************************************************************/
  /** General start-of-tag process, called after every end tag. */
  
  @Override public void afterUsxEndTag (String tagName,
                                        String style,
                                        int level,
                                        UsxParser.ElementDetails eltDetails,
                                        int destination) throws Exception
  {
    popDest();
    if (!"hash_text".equals(tagName)) m_ParsedTextOutputterStack.pop();
    super.afterUsxEndTag(tagName, style, level, eltDetails, destination);
  }
  
  
  /****************************************************************************/
  /** General start-of-tag process, called before every start tags. */
  
  @Override public void beforeUsxStartTag (String tagName,
                                           String style,
                                           int level,
                                           UsxParser.ElementDetails eltDetails,
                                           int destination) throws Exception
  {
    /**************************************************************************/
    super.beforeUsxStartTag(tagName, style, level, eltDetails, destination);
    
    
    
    /**************************************************************************/
    /* Make sure we use the correct stringifier. */
    
    if (!"hash_text".equals(tagName))
    {
      if ("rem".equals(style) || "restore".equals(style))
        m_ParsedTextOutputterStack.push(null); // Avoid attempting to find Bible refs in these.
      else
        //$$$ m_ParsedTextOutputterStack.push(m_HrefToBibleReferenceGenerator);
        m_ParsedTextOutputterStack.push(null);
    }
    
    
    
    /**************************************************************************/
    pushDest(destination);
  }

  
  /**************************************************************************/
  /**
     Performs all the relevant processing.

     @throws Exception
  */

  @Override public void process () throws Exception
  {
    makeFoldersAndCopyStandardFiles();
    initialiseFeatures();
    initialiseGeneral();
    super.process();
    writeMetaInf();
    writeMetaXml();
    writeMimeType();
    writeSettingsXml();
    zip();
  }

  
  
  
  
  /****************************************************************************/
  /****************************************************************************/
  /**                                                                        **/
  /**                                Protected                               **/
  /**                                                                        **/
  /****************************************************************************/
  /****************************************************************************/

  /****************************************************************************/
  @Override protected void processUsxTagEnd (String tagName,
  	                                     String style,
					     int level,
					     UsxParser.ElementDetails eltDetails,
					     int destination) throws Exception
  {
  }

  
  /****************************************************************************/
  @Override protected void processUsxTagStart (String tagName,
                                               String style,
	  				       int level,
					       UsxParser.ElementDetails eltDetails,
					       int destination) throws Exception
  {
  }
  

  /****************************************************************************/
  /****************************************************************************/
  /**                                                                        **/
  /**                     Specific tag handling routines                     **/
  /**                                                                        **/
  /****************************************************************************/
  /****************************************************************************/

  /****************************************************************************/
  // Book.
  @Override protected void start_book_id (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonStartOfBook(eltDetails);
    //$$$writeToGivenDest(destination, "<a class='book' id='b");
    //writeToGivenDest(destination, String.format("%02d", Bookmark.instance().getBookNo()));
    //writeToGivenDest(destination, "'></a>");
  }
  
  
  @Override protected void end_book_id (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }
  


  // Start of chapter in chapter-for-verse-style.
  @Override protected void start_c (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_c (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Chapter.
  @Override protected void start_chapter_c (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonStartOfChapter(eltDetails);
 
    int chapterNo = Bookmark.instance().getChapter();
    String s = "";

    if (1 == chapterNo) writeLineToGivenDest(destination, "<text:section text:style-name='section-" + Config.instance().getNumberOfColumns() + "-Columns' text:name='Book" + Bookmark.instance().getBookNo() + "'>");

    if (1 != chapterNo && Config.instance().getIncludeBookNameInChapterHeadings()) s = Bookmark.instance().getFullVernacularName() + " ";

    writeToCurrentDest("<text:a text:style-name='chapter-link-target' name='c" + Bookmark.instance().getBookNo() + "." + chapterNo + "'>");
    writeToCurrentDest("</text:a>");
      
    writeToCurrentDest("<text:h text:style-name='h3" + (1 == chapterNo ? "_noSpaceBefore" : "") + "'>");
    writeToCurrentDest(s);
    writeToCurrentDest(NumeralProcessor.instance().toVernacular(chapterNo));
    writeToCurrentDest("</text:h>");
  }

  @Override protected void end_chapter_c (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Abbreviation !! (character style)  e.g., JUD 1.9,14 (in footnote)  a.d. or  b.c.e to display in small caps. When rendering in HTML a mouse over event may show full text of abbreviation.
  @Override protected void start_char_abbreviation (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_abbreviation (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // For a translational addition to the text.
  @Override protected void start_char_add (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_add (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // For chinese words to be dot underline & underline.
  @Override protected void start_char_addpn (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_addpn (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A character style, use bold text.
  @Override protected void start_char_bd (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("span", "", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_char_bd (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("span", "", tagName, style, level, eltDetails, destination);
  }



  // A character style, use bold + italic text.
  @Override protected void start_char_bdit (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("span", "", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_char_bdit (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("span", "", tagName, style, level, eltDetails, destination);
  }



  // For the quoted name of a book.
  @Override protected void start_char_bk (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_bk (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Second (alternate) chapter number.
  @Override protected void start_char_ca (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_ca (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Deuterocanonical/LXX additions or insertions in the Protocanonical text.
  @Override protected void start_char_dc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_dc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Reference to caller of previous footnote in a study Bible.
  @Override protected void start_char_efm (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_efm (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A character style, use emphasized text style.
  @Override protected void start_char_em (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("span", "", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_char_em (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("span", "", tagName, style, level, eltDetails, destination);
  }



  // Footnote text, applies to Deuterocanon only.
  @Override protected void start_char_fdc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_fdc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A footnote keyword.
  @Override protected void start_char_fk (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_fk (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A footnote label text item, for marking or "labelling" the type or alternate translation being provided in the note.
  @Override protected void start_char_fl (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_fl (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Reference to caller of previous footnote.
  @Override protected void start_char_fm (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_fm (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A footnote additional paragraph marker.
  @Override protected void start_char_fp (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_fp (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A footnote scripture quote or alternate rendering.
  @Override protected void start_char_fq (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_fq (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A footnote alternate rendering for a portion of scripture text.
  @Override protected void start_char_fqa (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_fqa (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // The origin reference for the footnote.
  @Override protected void start_char_fr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_fr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Footnote text, Protocanon.
  @Override protected void start_char_ft (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_ft (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A verse number within the footnote text.
  @Override protected void start_char_fv (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_fv (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction references range for outline entry; for marking references separately.
  @Override protected void start_char_ior (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_ior (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // For quoted scripture text appearing in the introduction.
  @Override protected void start_char_iqt (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_iqt (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A character style, use italic text.
  @Override protected void start_char_it (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("span", "", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_char_it (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("span", "", tagName, style, level, eltDetails, destination);
  }



  // For a keyword.
  @Override protected void start_char_k (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_k (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Label !! (inline section head) EZR 10:18-24 (TEV)
  @Override protected void start_char_label (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_label (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // For name of deity.
  @Override protected void start_char_nd (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_nd (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A subject index text item.
  @Override protected void start_char_ndx (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_ndx (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A character style, use normal text.
  @Override protected void start_char_no (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_no (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // For the text portion of an ordinal number.
  @Override protected void start_char_ord (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_ord (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // For a proper name.
  @Override protected void start_char_pn (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_pn (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // For indicating pronunciation in CJK texts.
  @Override protected void start_char_pro (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_pro (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Poetry text, Acrostic markup of the first character of a line of acrostic poetry.
  @Override protected void start_char_qac (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_qac (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Poetry text, Selah.
  @Override protected void start_char_qs (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("span", "", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_char_qs (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("span", "", tagName, style, level, eltDetails, destination);
  }



  // For Old Testament quoted text appearing in the New Testament.
  @Override protected void start_char_qt (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_qt (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Remark.
  @Override public void start_char_rem (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    writeToCurrentDest("<!-- ");
  }
  
  @Override public void end_char_rem (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    writeToCurrentDest(" -->");
  }



  // A cross-reference indicating the source text for the preceding quotation..
  @Override protected void start_char_rq (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_rq (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Character style, for small capitalization text.
  @Override protected void start_char_sc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_sc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // For the signature of the author of an Epistle.
  @Override protected void start_char_sig (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_sig (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // To represent where the original text is in a secondary language or from an alternate text source.
  @Override protected void start_char_sls (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_sls (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table cell item, column 1.
  @Override protected void start_char_tc1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_tc1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table cell item, column 1.
  @Override protected void start_char_tc2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_tc2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table cell item, column 1.
  @Override protected void start_char_tc3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_tc3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table cell item, column 1.
  @Override protected void start_char_tc4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_tc4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table cell item, column 1, right aligned.
  @Override protected void start_char_tcr1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_tcr1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table cell item, column 1, right aligned.
  @Override protected void start_char_tcr2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_tcr2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table cell item, column 1, right aligned.
  @Override protected void start_char_tcr3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_tcr3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table cell item, column 1, right aligned.
  @Override protected void start_char_tcr4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_tcr4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table heading, column 1.
  @Override protected void start_char_th1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_th1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table heading, column 1.
  @Override protected void start_char_th2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_th2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table heading, column 1.
  @Override protected void start_char_th3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_th3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table heading, column 1.
  @Override protected void start_char_th4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_th4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table heading, column 1, right aligned.
  @Override protected void start_char_thr1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_thr1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table heading, column 1, right aligned.
  @Override protected void start_char_thr2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_thr2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table heading, column 1, right aligned.
  @Override protected void start_char_thr3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_thr3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A table heading, column 1, right aligned.
  @Override protected void start_char_thr4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_thr4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // For transliterated words.
  @Override protected void start_char_tl (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_tl (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Second (alternate) verse number (for coding dual numeration in Psalms; see also NRSV Exo 22.1-4).
  @Override protected void start_char_va (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_va (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Published verse marker - this is a verse marking that would be used in the published text.
  @Override protected void start_char_vp (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_vp (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A wordlist text item.
  @Override protected void start_char_w (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_w (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A Greek Wordlist text item.
  @Override protected void start_char_wg (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_wg (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A Hebrew wordlist text item.
  @Override protected void start_char_wh (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_wh (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // For marking the words of Jesus.
  @Override protected void start_char_wj (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("span", "", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_char_wj (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("span", "", tagName, style, level, eltDetails, destination);
  }



  // Cross-reference target reference(s), Deuterocanon only.
  @Override protected void start_char_xdc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_xdc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A cross reference keyword.
  @Override protected void start_char_xk (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_xk (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Cross-reference target reference(s), New Testament only.
  @Override protected void start_char_xnt (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_xnt (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // The cross reference origin reference.
  @Override protected void start_char_xo (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_xo (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Cross-reference target reference(s), Old Testament only.
  @Override protected void start_char_xot (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_xot (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A cross-reference quotation from the scripture text.
  @Override protected void start_char_xq (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_xq (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // The cross reference target reference(s), protocanon only.
  @Override protected void start_char_xt (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_char_xt (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Generated internally by the Xerces parser if it sees an XML comment.
  @Override protected void start_hash_comment (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_hash_comment (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Generated internally by the Xerces parser to flag text.
  @Override public void start_hash_text (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    String text = translateText(eltDetails.getNodeValue());

    
    
    /**************************************************************************/
    /* If we're processing scripture output, there's no need to worry about
     * handling cross-references, because there won't be any.  (And in fact,
     * it's best to avoid such processing anyway, because I have come across
     * one vernacular where numbers (such as 40 days and 40 nights) were
     * actually given as numerals, rather than text, which confused things.
     */
    
    if (UsxTagDetails.Canonicity.C_Canonical != m_CanonicityStack.peek())
    {
      ParsedTextOutputter outputter = m_ParsedTextOutputterStack.peek();
      if (null != outputter)
      {
        ParsedText parsedText =
          BibleReferenceParser.instance().parse(text, Bookmark.instance().getFullVernacularName(), NumeralProcessor.instance());
        text = outputter.toString(parsedText);
      }
    }
     
    writeToCurrentDest(text);
  }
  
  @Override public void end_hash_text (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }


  // Called at the start of the introductory material.
  @Override protected void start_extension_introductionBlock
    (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    linkFromScripture(OutputManager.C_Destination_Introduction,
                      BookAssembly.instance().getUltimateFileNameForIntroduction(),
                      Config.instance().getOutputIntroductionDisposition(),
		      "i",
                      "+");
    // Don't push destination here -- this is a pseudo tag.
  }
  
  

  // Called at the end of the introductory material.
  @Override protected void end_extension_introductionBlock
    (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    // Don't pop destination here -- this is a pseudo tag.
  }
  
  

  // Figure.  We don't currently do anything with figures, for copyright reasons.
  @Override public void start_fig (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }
  
  @Override public void end_fig (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }


  // Footnote position in main text.
  @Override protected void start_note_f (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    linkFromScripture(OutputManager.C_Destination_Footnotes,
                      BookAssembly.instance().getUltimateFileNameForFootnotes(),
                      Config.instance().getOutputFootnotesDisposition(),
		      style,
                      eltDetails.getAttribute("caller"));
    pushDest(destination);
  }

  @Override protected void end_note_f (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    popDest();
  }


  /* Endnote position in main text. */
  @Override protected void start_note_fe (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    linkFromScripture(OutputManager.C_Destination_Endnotes,
                      BookAssembly.instance().getUltimateFileNameForEndnotes(),
                      Config.instance().getOutputEndnotesDisposition(),
		      style,
                      eltDetails.getAttribute("caller"));
    pushDest(destination);
  }

  @Override protected void end_note_fe (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    popDest();
  }



  // Cross-reference position in main text.
  @Override protected void start_note_x (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    linkFromScripture(OutputManager.C_Destination_CrossReferences,
                      BookAssembly.instance().getUltimateFileNameForCrossReferences(),
                      Config.instance().getOutputCrossReferencesDisposition(),
		      style,
                      eltDetails.getAttribute("caller"));
    pushDest(destination);
  }

  @Override protected void end_note_x (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    popDest();
  }



  // Poetry text stanza break (e.g. stanza break).
  @Override protected void start_para_b (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_b (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Breaking verse paragraph.
  @Override protected void start_para_breaking_verse_paragraph (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_breaking_verse_paragraph (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Chapter Description (Publishing option D, e.g. in Russian Bibles).
  @Override protected void start_para_cd (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_cd (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Chapter label used for translations that add a word such as "Chapter".
  @Override protected void start_para_cl (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_cl (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Citation Line1 MRK 1.1-4 (NET)
  @Override protected void start_para_cl1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_cl1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Citation Line2 MRK 1.1-4 (NET)
  @Override protected void start_para_cl2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_cl2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Closure of an Epistle.
  @Override protected void start_para_cls (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_cls (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Published chapter number .
  @Override protected void start_para_cp (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_cp (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A Hebrew text heading, to provide description (e.g. Psalms).
  @Override protected void start_para_d (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_d (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Running header text for a book.
  @Override protected void start_para_h (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_h (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Running header text.
  @Override protected void start_para_h1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("h", "text:outline-level='" + level + "'", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_para_h1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("h", "", tagName, style, level, eltDetails, destination);
  }



  // Running header text, left side of page.
  @Override protected void start_para_h2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("h", "text:outline-level='" + level + "'", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_para_h2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("h", "", tagName, style, level, eltDetails, destination);
  }



  // Running header text, right side of page.
  @Override protected void start_para_h3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("h", "text:outline-level='" + level + "'", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_para_h3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("h", "", tagName, style, level, eltDetails, destination);
  }



  // Introduction blank line.
  @Override protected void start_para_ib (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_ib (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // File encoding information.
  @Override protected void start_para_ide (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_ide (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction ending marker.
  @Override protected void start_para_ie (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_ie (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction explanatory or bridge text (e.g. explanation of missing book in Short Old Testament).
  @Override protected void start_para_iex (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_iex (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A list entry, level 1 (if single level).
  @Override protected void start_para_ili (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_ili (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A list entry, level 1 (if multiple levels).
  @Override protected void start_para_ili1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_ili1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A list entry, level 2.
  @Override protected void start_para_ili2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_ili2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction prose paragraph, with no first line indent (may occur after poetry).
  @Override protected void start_para_im (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_im (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction prose paragraph text, indented, with no first line indent.
  @Override protected void start_para_imi (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_imi (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction prose paragraph, quote from the body text, with no first line indent.
  @Override protected void start_para_imq (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_imq (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction major title, level 1 (if single level).
  @Override protected void start_para_imt (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_imt (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction major title, level 1 (if multiple levels).
  @Override protected void start_para_imt1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_imt1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction major title, level 2.
  @Override protected void start_para_imt2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_imt2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction major title, level 3.
  @Override protected void start_para_imt3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_imt3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction major title, level 4 (usually within parenthesis).
  @Override protected void start_para_imt4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_imt4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction major title at introduction end, level 1 (if single level).
  @Override protected void start_para_imte (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_imte (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction major title at introduction end, level 1 (if multiple levels).
  @Override protected void start_para_imte1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_imte1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction major title at introduction end, level 2.
  @Override protected void start_para_imte2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_imte2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction outline text, level 1 (if single level).
  @Override protected void start_para_io (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_io (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction outline text, level 1 (if multiple levels).
  @Override protected void start_para_io1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_io1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction outline text, level 2.
  @Override protected void start_para_io2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_io2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction outline text, level 3.
  @Override protected void start_para_io3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_io3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction outline text, level 4.
  @Override protected void start_para_io4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_io4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction outline title.
  @Override protected void start_para_iot (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_iot (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction prose paragraph.
  @Override protected void start_para_ip (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("p", "", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_para_ip (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("p", "", tagName, style, level, eltDetails, destination);
  }



  // Introduction prose paragraph, indented, with first line indent.
  @Override protected void start_para_ipi (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_ipi (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction prose paragraph, quote from the body text.
  @Override protected void start_para_ipq (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_ipq (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction prose paragraph, right aligned.
  @Override protected void start_para_ipr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_ipr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction poetry text, level 1 (if single level).
  @Override protected void start_para_iq (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_iq (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction poetry text, level 1 (if multiple levels).
  @Override protected void start_para_iq1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_iq1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction poetry text, level 2 .
  @Override protected void start_para_iq2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_iq2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction poetry text, level 3.
  @Override protected void start_para_iq3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_iq3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Introduction section heading, level 1 (if single level).
  @Override protected void start_para_is (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("h", "text:outline-level='" + level + "'", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_para_is (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("h", "", tagName, style, level, eltDetails, destination);
  }



  // Introduction section heading, level 1 (if multiple levels).
  @Override protected void start_para_is1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("h", "text:outline-level='" + level + "'", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_para_is1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
     commonTagEnd("h", "", tagName, style, level, eltDetails, destination);
 }



  // Introduction section heading, level 2 .
  @Override protected void start_para_is2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("h", "text:outline-level='" + level + "'", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_para_is2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("h", "", tagName, style, level, eltDetails, destination);
  }



  // Concordance main entry text or keyword, level 1.
  @Override protected void start_para_k1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_k1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Concordance main entry text or keyword, level 2.
  @Override protected void start_para_k2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_k2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A list entry, level 1 (if single level).
  @Override protected void start_para_li (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_li (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A list entry, level 1 (if multiple levels).
  @Override protected void start_para_li1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_li1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A list entry, level 2.
  @Override protected void start_para_li2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_li2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A list entry, level 3.
  @Override protected void start_para_li3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_li3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A list entry, level 4.
  @Override protected void start_para_li4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_li4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // For a comment or note inserted for liturgical use.
  @Override protected void start_para_lit (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_lit (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Paragraph text, with no first line indent (may occur after poetry) aka: Paragraph Continuation.
  @Override protected void start_para_m (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_m (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Paragraph text, indented, with no first line indent; often used for discourse.
  @Override protected void start_para_mi (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_mi (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A major section division references range heading.
  @Override protected void start_para_mr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_mr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A major section division heading, level 1 (if single level).
  @Override protected void start_para_ms (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_ms (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A major section division heading, level 1 (if multiple levels).
  @Override protected void start_para_ms1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_ms1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A major section division heading, level 2.
  @Override protected void start_para_ms2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_ms2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A major section division heading, level 3.
  @Override protected void start_para_ms3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_ms3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // The main title of the book (if single level).
  @Override protected void start_para_mt (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("p", "", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_para_mt (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("p", "", tagName, style, level, eltDetails, destination);
  }



  // The main title of the book (if multiple levels).
  @Override protected void start_para_mt1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_mt1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A secondary title usually occurring before the main title.
  @Override protected void start_para_mt2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_mt2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A tertiary title occurring after the main title.
  @Override protected void start_para_mt3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_mt3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // I have not seen a use case for this.
  @Override protected void start_para_mt4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_mt4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // The main title of the book repeated at the end of the book, level 1 (if single level).
  @Override protected void start_para_mte (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_mte (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // The main title of the book repeated at the end of the book, level 1 (if multiple levels).
  @Override protected void start_para_mte1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_mte1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A secondary title occurring before or after the 'ending' main title.
  @Override protected void start_para_mte2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_mte2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Paragraph text, with no break from previous paragraph text (at chapter boundary).
  @Override protected void start_para_nb (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_nb (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // No break verse paragraph.
  @Override protected void start_para_no_break_verse_paragraph (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_no_break_verse_paragraph (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Paragraph text, with first line indent.
  @Override protected void start_para_p (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("p", "", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_para_p (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("p", "", tagName, style, level, eltDetails, destination);
  }



  // Paragraph_Introduction e.g., GEN 5:1, 6:9; JER 48:1a; 49:1a Biblica: pIntroduction An introduction statement (paragraphp_conclusion Paragraph_Conclusion e.g., EZK 7:27f; 23:34d; 24:14 Biblica; pConclusion A paragraph containing a summary (or conclusion) statement related to the preceding text. Usually rendered with line space preceding and following. pm
  @Override protected void start_para_p_introduction (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_p_introduction (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Letter_Closing_Paragraph Biblica: pClosing
  @Override protected void start_para_p_letter_closing (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_p_letter_closing (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Letter_Opening_Paragraph e.g., ROM 1:1-6, 7a, 7b Biblica pOpening
  @Override protected void start_para_p_letter_opening (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_p_letter_opening (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Paragraph_Variant e.g., JHN 8; MRK 16 often in italic
  @Override protected void start_para_p_variant (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_p_variant (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Front or back matter text paragraph, level 1 (if multiple levels).
  @Override protected void start_para_p1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_p1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Front or back matter text paragraph, level 2 (if multiple levels).
  @Override protected void start_para_p2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_p2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Page Break used for new reader portions and children's bibles where content is controlled by the page.
  @Override protected void start_para_pb (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_pb (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Paragraph text, centered (for Inscription).
  @Override protected void start_para_pc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_pc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Periheral content division marker which should be followed by an additional division argument/title.
  @Override protected void start_para_periph (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_periph (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Paragraph text, level 1 indent (if single level), with first line indent; often used for discourse.
  @Override protected void start_para_pi (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_pi (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Paragraph text, level 1 indent (if multiple levels), with first line indent; often used for discourse.
  @Override protected void start_para_pi1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_pi1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Paragraph text, level 2 indent, with first line indent; often used for discourse.
  @Override protected void start_para_pi2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_pi2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Paragraph text, level 3 indent, with first line indent; often used for discourse.
  @Override protected void start_para_pi3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_pi3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Embedded text paragraph.
  @Override protected void start_para_pm (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_pm (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Embedded text closing.
  @Override protected void start_para_pmc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_pmc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Embedded text opening.
  @Override protected void start_para_pmo (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_pmo (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Embedded text refrain (e.g. Then all the people shall say, "Amen!").
  @Override protected void start_para_pmr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_pmr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Set_Apart_Paragraph e.g., DEU 28:3-6; JOS 15:2-12a
  @Override protected void start_para_psa (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_psa (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Set_Apart_Paragraph_Conclusion e.g., EXO 6:25b
  @Override protected void start_para_psa_conclusion (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_psa_conclusion (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Set_Apart_Paragraph_Continuation e.g., NUM 7:13-17, 19-23, etc. JOS 13:2-5
  @Override protected void start_para_psa_continuation (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_psa_continuation (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Set_Apart_Paragraph_Introduction e.g., EXO 6:14
  @Override protected void start_para_psa_introduction (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_psa_introduction (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Poetry text, level 1 indent (if single level).
  @Override protected void start_para_q (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("p", "", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_para_q (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("p", "", tagName, style, level, eltDetails, destination);
  }



  // Poetry text, level 1 indent (if multiple levels).
  @Override protected void start_para_q1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_q1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Poetry text, level 2 indent.
  @Override protected void start_para_q2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_q2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Poetry text, level 3 indent.
  @Override protected void start_para_q3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_q3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Poetry text, level 4 indent.
  @Override protected void start_para_q4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_q4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Poetry text, Acrostic marker/heading.
  @Override protected void start_para_qa (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_qa (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Poetry text, centered.
  @Override protected void start_para_qc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_qc (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Poetry text, embedded, level 1 indent (if single level).
  @Override protected void start_para_qm (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_qm (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Poetry text, embedded, level 1 indent (if multiple levels).
  @Override protected void start_para_qm1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_qm1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Poetry text, embedded, level 2 indent.
  @Override protected void start_para_qm2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_qm2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Poetry text, embedded, level 3 indent.
  @Override protected void start_para_qm3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_qm3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Poetry text, Right Aligned
  @Override protected void start_para_qr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_qr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Attribution e.g., ACT 7:49-50 (NIV) says the Lord (Acts 7:49, 1 Corinthians 14:21, 2 Corinthians 6:17, 18) declares the Lord (Hebrews 8:9, 2 Kings 19:33, Isaiah 14:22) More examples are found in Isaiah, Jeremiah, Ezekiel, Hosea, Amos, Obadiah, Zephaniah, and Zechariah.
  @Override protected void start_para_qr_attribution (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_qr_attribution (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Refrain e.g., PSA 136:1-3 (NIV); His love endures forever.  DEU 27:16-21 (NIV) Then all the people shall say, Amen! In NIV this is Embedded_Text_Refrain
  @Override protected void start_para_qr_refrain (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_qr_refrain (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Selah e.g., PSA and HAB only
  @Override protected void start_para_qr_selah (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_qr_selah (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Parallel reference(s).
  @Override protected void start_para_r (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
     commonTagStart("p", "", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_para_r (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("p", "", tagName, style, level, eltDetails, destination);
  }



  // A section heading, level 1 (if single level).
  @Override protected void start_para_s (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagStart("h", "text:outline-level='" + level + "'", tagName, style, level, eltDetails, destination);
  }

  @Override protected void end_para_s (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    commonTagEnd("h", "", tagName, style, level, eltDetails, destination);
  }



  // Section_Head_Variant e.g., JHN 8; MRK 16 sometimes a line above and italic
  @Override protected void start_para_s_variant (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_s_variant (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Section_Tail_Variant e.g., JHN 8 formatted with line
  @Override protected void start_para_s_variant_tail (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_s_variant_tail (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A section heading, level 1 (if multiple levels).
  @Override protected void start_para_s1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_s1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Variant_Section_Head - a section heading, level 2 (e.g. Proverbs 22-24)
  @Override protected void start_para_s2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_s2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A section heading, level 3 (e.g. Genesis "The First Day").
  @Override protected void start_para_s3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_s3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A section heading, level 4.
  @Override protected void start_para_s4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_s4 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A heading, to identify the speaker (e.g. Job).
  @Override protected void start_para_sp (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_sp (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // A section division references range heading.
  @Override protected void start_para_sr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_sr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Long table of contents text.
  @Override protected void start_para_toc1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_toc1 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Short table of contents text.
  @Override protected void start_para_toc2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_toc2 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Book Abbreviation.
  @Override protected void start_para_toc3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_toc3 (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Table row.
  @Override protected void start_para_tr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_para_tr (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Reference.
  @Override protected void start_reference (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_reference (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Remark.
  @Override public void start_para_rem (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    writeLineToCurrentDest("<!-- ");
  }
  
  @Override public void end_para_rem (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    writeLineToCurrentDest(" -->");
  }


  // Comment about when text was restored.  
  @Override public void start_para_restore (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    writeLineToCurrentDest("<!-- ");
  }
  
  @Override public void end_para_restore (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    writeLineToCurrentDest(" -->");
  }


  // USX root.
  @Override protected void start_usx (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_usx (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    writeLineToGivenDest(destination, "</text:section>");
  }



  // USXV root.
  @Override protected void start_usxv (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_usxv (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  // Start of verse in verse-for-verse-style.
  @Override protected void start_v (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }

  @Override protected void end_v (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }



  /****************************************************************************/
  /* Verse marker. */

  @Override protected void start_verse_v (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    /**************************************************************************/
    commonStartOfVerse(eltDetails);
    
    
    
    /**************************************************************************/
    /* firstVerseForWhichToOutputAnchor requires some explanation.  It was
     * introduced to handle a situation where we had 2-6a as the
     * verse number for one verse, and 6b-11 for the second.  I
     * deliberately don't include the subverse in the anchors,
     * because (rightly or wrongly) I make the assumption that if
     * anything refers to a verse, it's likely to do so at the
     * level of the verse, rather than the subverse.  However,
     * this was giving me a duplicate anchor, since both the first
     * chunk and the second chunk were making reference to 6.
     * To get round that, I check to see if the low verse from this
     * time is the same as the high from last time, in which case
     * I don't generate an anchor for the low verse.
     */
      
    int low = Bookmark.instance().getVerseLow();
    int high = Bookmark.instance().getVerseHigh();
    int firstVerseForWhichToOutputAnchor = (Bookmark.instance().getVerseLowEqualsPreviousVerseHigh() ? low + 1 : low);




    /**************************************************************************/
    for (int i = firstVerseForWhichToOutputAnchor; i <= high; ++i)
    {
      writeToCurrentDest("<text:a text:style-name='verse-link-target' name='v");
      writeToCurrentDest(Integer.toString(Bookmark.instance().getBookNo()));
      writeToCurrentDest(".");
      writeToCurrentDest(Integer.toString(Bookmark.instance().getChapter()));
      writeToCurrentDest(".");
      writeToCurrentDest(Integer.toString(i));
      writeToCurrentDest("'></text:a>");
    }

    if ("begin".equalsIgnoreCase(Config.instance().getVerseNumberLocation()))
      outputVerseNumber(destination,
                        Config.instance().getPrefixForVerseMarkersWhichAppearAtStartOfVerse(),
                        Config.instance().getSuffixForVerseMarkersWhichAppearAtStartOfVerse(),
                        low, Bookmark.instance().getSubVerseLow(),
                        high, Bookmark.instance().getSubVerseHigh());
  }

  @Override protected void end_verse_v (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
  }
  
  
  /**************************************************************************/
  /* User-defined stuff. */
    
  @Override protected void start_userDefinedPara_bra_introductoryMaterial (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
    {
      writeLineToGivenDest(destination, "<!-- Introductory material start -->");
    }
    
    @Override protected void end_userDefinedPara_bra_introductoryMaterial (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
    {
    }
    
    @Override protected void start_userDefinedPara_ket_introductoryMaterial (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
    {
       writeLineToGivenDest(destination, "<!-- Introductory material end -->");
    }
    
    @Override protected void end_userDefinedPara_ket_introductoryMaterial (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
    {
    }
    
    @Override protected void start_userDefinedPara_bra_ul (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
    {
      writeLineToGivenDest(destination, "<ul>");
    }
    
    @Override protected void end_userDefinedPara_bra_ul (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
    {
    }
    
    @Override protected void start_userDefinedPara_ket_ul (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
    {
      writeLineToGivenDest(destination, "</ul>");
    }
    
    @Override protected void end_userDefinedPara_ket_ul (String tagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
    {
    }
    
    
    
  /****************************************************************************/
  private void commonTagEnd (String odtTag, String otherInfo, String usxTagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    writeToGivenDest(destination, "</text:" + odtTag + ">");
    if ("para".equals(usxTagName)) writeLineToGivenDest(destination, "");
  }


  /****************************************************************************/
  private void commonTagStart (String odtTag, String otherInfo, String usxTagName, String style, int level, UsxParser.ElementDetails eltDetails, int destination) throws Exception
  {
    String s = style;
    if (0 != level) s += level;
    writeToGivenDest(destination, "<text:" + odtTag + " text:style-name='" + s + "' " + otherInfo + ">");
    if ("para".equals(usxTagName)) writeLineToGivenDest(destination, "");
  }




  
  /****************************************************************************/
  /****************************************************************************/
  /**                                                                        **/
  /**                                Private                                 **/
  /**                                                                        **/
  /****************************************************************************/
  /****************************************************************************/

  /****************************************************************************/
  /* Returns the name of the thumbnail file, or an empty string if there
     isn't one. */
      
  private String getThumbnailFile () throws IOException
  {
    String folderName = Config.instance().getOutputFolderPath() + "/Thumbnails";
    return Utils.getSingleMatchingFileFromFolder(folderName, "*.*", false);
  }
  
  
  /****************************************************************************/
  /* Does what it says on the tin. */
  
  private void makeFoldersAndCopyStandardFiles () throws IOException
  {
    String outputFolder = Config.instance().getOutputFolderPath();
    (new File(outputFolder)).mkdir();
    (new File(outputFolder + "Configurations2")).mkdir();
    (new File(outputFolder + "META-INF")).mkdir();
    (new File(outputFolder + "Pictures")).mkdir();
    (new File(outputFolder + "Thumbnails")).mkdir();
    
    String folderName = outputFolder + "../Resources/Thumbnails";
    String fileName = Utils.getSingleMatchingFileFromFolder(folderName, "*.*", false);
    if (0 != fileName.length())
    {
      fileName = (new File(fileName)).getName();
      Utils.fileCopy(outputFolder + "Thumbnails/thumbnail" + fileName.substring(fileName.lastIndexOf(".")), folderName + "/" + fileName);
    }
    
    folderName = outputFolder + "../Resources/Styles";
    fileName = Utils.getSingleMatchingFileFromFolder(folderName, "*.*", false);
    if (0 != fileName.length())
    {
      fileName = (new File(fileName)).getName();
      Utils.fileCopy(outputFolder + "styles.xml", folderName + "/" + fileName);
    }
  }
  
  
  /****************************************************************************/
  /* Initialises the features list. */

  private void initialiseFeatures () throws IOException
  {
    FeatureManager features = FeatureManager.instance();
    features.setOptionListForOutputOverallDisposition("Combined");
    features.setOptionListForOutputIntroductionDisposition("InSituInTextFile");
    features.setOptionListForOutputCrossReferencesDisposition("InSituInTextFile");
    features.setOptionListForOutputFootnotesDisposition("InSituInTextFile");
    features.setOptionListForOutputEndnotesDisposition("InSituInTextFile");
    features.setOptionListForOutputScriptureTextDisposition("Combined");
    features.setAcceptDirectivesFromBookAssembly(true);
    features.setSupportsToc(true);
    features.setDefaultForOutputIntroductionDisposition("InSituInTextFile");
    
    Config.instance().setOutputOverallDisposition("Combined");
    Config.instance().setOutputScriptureTextDisposition("Combined");
    Config.instance().setOutputTocDisposition("PerChapter");
    Config.instance().setOutputEndnotesDisposition("InSituInTextFile");
    Config.instance().setOutputFootnotesDisposition("InSituInTextFile");
    Config.instance().setOutputIntroductionDisposition("InSituInTextFile");
    Config.instance().setOutputCrossReferencesDisposition("InSituInTextFile");
    
    //Config.instance().setOutputTocFileName(Config.instance().getIso() + "-Toc." + Config.instance().getOutputFileExtension());
    
    features.validateConfigurationParameters(-1);
    Config.instance().setOutputScriptureTextFileName("content.xml");
  }
  
  
  /****************************************************************************/
  /** Carries out general initialisation. */

  private void initialiseGeneral () throws IOException, ConverterException
  {
    m_Parser = new UsxParser(this);
    m_FootnoteMarkerManager = new FootnoteMarkerManager(NumeralProcessor.instance());
    m_FootnoteMarkerManager.setPrefix("");
    m_FootnoteMarkerManager.setSuffix("");
    m_ParsedTextOutputterStack.push(m_HrefToBibleReferenceGenerator);
    
    BookAssembly.instance().setPrefixesAndSuffixes(C_NotesPrefixInTextFile,
                                                   C_NotesSuffixInTextFile,
                                                   C_StartOfMainContent,
                                                   C_EndOfMainContent);
    
    BookAssembly.instance().setHeaderAndTrailerWriters(m_HeaderAndTrailerWriterScripture,
                                                       null, 
                                                       null, 
                                                       null);
  }


  /****************************************************************************/
  /* Called at the time we hit something which requires us to link from the
     scripture file to one of the others.  Generates an anchor in the main
     file to serve as the return target, a link in the main file to the
     subsidiary file, and a return link. */

  private void linkFromScripture (int targetDestination,
                                  String targetBookName,
                                  String targetDisposition,
				  String type,
                                  String caller) throws IOException
  {
    /**************************************************************************/
    /* Nothing to do if we're generating output in situ.  Otherwise, we'll
     * need a link in the scripture file to which we can return. */
    
    if ("InSituInTextFile".equalsIgnoreCase(targetDisposition)) return;



    /**************************************************************************/
    /* Get a string we can use to identify the reference.  I include the
     * book / chapter and verse in this to make debugging easier -- it
     * doesn't have to be there to make anything work.
     */
    
    ++m_AnchorNo;
    String ref = Integer.toString(Bookmark.instance().getBookNo()) + "." +
                 Integer.toString(Bookmark.instance().getChapter()) + "." +
                 Integer.toString(0 == Bookmark.instance().getVerse() ? 1 : Bookmark.instance().getVerse()) + "." +
                 Integer.toString(m_AnchorNo);
   
    
    
    /**************************************************************************/
    /* Return target in main file. */
    
    int scripture = OutputManager.C_Destination_Scripture;
    String thisType = type + "_s2m_tgt";
    String refInMain = thisType + "_" + ref;
    writeLineToGivenDest(scripture, "");
    writeToGivenDest(scripture, "<a class='" + thisType + "' id='" + refInMain);
    writeLineToGivenDest(scripture, "'></a>");

    
    
    /**************************************************************************/
    /* Link main file to subsidiary file. */
    
    thisType = type + "_m2s_ref";
    String refInSubsidiary = thisType + "_" + ref;
    writeToGivenDest(scripture, "<a class='" + thisType + "' href='");
    writeToGivenDest(scripture, targetBookName + "#" + refInSubsidiary);
    writeToGivenDest(scripture, "'>");
    writeToGivenDest(scripture, "<sup class='" + thisType + "'>");
    writeToGivenDest(scripture, m_FootnoteMarkerManager.getFootnoteMarker(caller));
    writeToGivenDest(scripture, "</sup>");
    writeLineToGivenDest(scripture, "</a>");

    
    
    /**************************************************************************/
    /* Anchor in subsidiary file. */
    
    thisType = type + "_s2m_tgt";
    writeLineToGivenDest(targetDestination, "");
    writeLineToGivenDest(targetDestination, "<hr />");
    writeToGivenDest(targetDestination, "<a class='" + thisType + "' id='" + refInSubsidiary);
    writeLineToGivenDest(targetDestination, "'></a>");

    
    
    /**************************************************************************/
    /* Link subsidiary file to main file. */
    
    thisType = type + "_s2m_ref";
    writeToGivenDest(targetDestination, "<a class='" + thisType + "' href='");
    writeToGivenDest(targetDestination, BookAssembly.instance().getUltimateFileNameForScripture() + "#" + refInMain);
    writeToGivenDest(targetDestination, "'>");
    writeToGivenDest(targetDestination, "<sup class='" + thisType + "'>");
    writeToGivenDest(targetDestination, m_FootnoteMarkerManager.getMostRecentFootnoteMarker());
    writeToGivenDest(targetDestination, "</sup>");
    writeLineToGivenDest(targetDestination, "</a>");
  }

  
  /****************************************************************************/
  /* Write the manifest files -- lists all the other files in the ODT output. */

  private void writeMetaInf () throws IOException
  {
    String filePath = Config.instance().getOutputFolderPath() + "META-INF/manifest.xml";
    FileOutputStream f = new FileOutputStream(filePath);
    BufferedWriter w = new BufferedWriter(new OutputStreamWriter(f, "UTF-8"));
    
    w.write("<?xml version='1.0' encoding='UTF-8'?>"); w.newLine();
    w.write("  <!DOCTYPE manifest:manifest PUBLIC '-//OpenOffice.org//DTD Manifest 1.0//EN' 'Manifest.dtd'>"); w.newLine();
    w.write("  <manifest:manifest xmlns:manifest='urn:oasis:names:tc:opendocument:xmlns:manifest:1.0'>"); w.newLine();
    w.write("  <manifest:file-entry manifest:media-type='application/vnd.oasis.opendocument.text' manifest:full-path='/'/>"); w.newLine();
    w.write("  <manifest:file-entry manifest:media-type='application/vnd.sun.xml.ui.configuration' manifest:full-path='Configurations2/'/>"); w.newLine();
    w.write("  <manifest:file-entry manifest:media-type='text/xml' manifest:full-path='content.xml'/>"); w.newLine();
    w.write("  <manifest:file-entry manifest:media-type='text/xml' manifest:full-path='styles.xml'/>"); w.newLine();
    w.write("  <manifest:file-entry manifest:media-type='text/xml' manifest:full-path='meta.xml'/>"); w.newLine();
    
    String thumbnailFile = getThumbnailFile();
    if (0 != thumbnailFile.length())
    {
      thumbnailFile = "Thumbnails/" + (new File(thumbnailFile)).getName();
      w.write("  <manifest:file-entry manifest:media-type='' manifest:full-path='Thumbnails/" + thumbnailFile + "'/>");
      w.newLine();
    }
    
    w.write("  <manifest:file-entry manifest:media-type='' manifest:full-path='Thumbnails/'/>"); w.newLine();
    w.write("  <manifest:file-entry manifest:media-type='text/xml' manifest:full-path='settings.xml'/>"); w.newLine();
    w.write("</manifest:manifest>"); w.newLine();

    w.close();
    f.close();
  }


  /****************************************************************************/
  /* Write the meta.xml file. */

  private void writeMetaXml () throws IOException
  {
    Config cfg = Config.instance();
    String creationDate = new SimpleDateFormat("yyyy-MM-dd@HH:mm:ss").format(Calendar.getInstance().getTime());

    String filePath = Config.instance().getOutputFolderPath() + "meta.xml";
    FileOutputStream f = new FileOutputStream(filePath);
    BufferedWriter w = new BufferedWriter(new OutputStreamWriter(f, "UTF-8"));
    
    String[] items = { "dc:title", cfg.getDcTitle(),
                       "dc:subject", cfg.getDcSubject(),
                       "dc:description", cfg.getDcDescription(),
                       "dc:creator", cfg.getDcCreator(),
                       "dc:date", cfg.getDcDate(),
                       "dc:language", cfg.getDcLanguage(),
                       "meta:generator", "www.kalaam.org/UsxConverterToOdt",
                       "meta:initial-creator", "???Initial creator???",
                       "meta:creation-date", creationDate.replace("@", "T"),
                       "meta:keyword", "keyword-1",
                       "meta:keyword", "keyword-2",
            };

    w.write("<?xml version='1.0' encoding='UTF-8'?>"); w.newLine();
    w.write("<office:document-meta xmlns:office='urn:oasis:names:tc:opendocument:xmlns:office:1.0' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:meta='urn:oasis:names:tc:opendocument:xmlns:meta:1.0' xmlns:ooo='http://openoffice.org/2004/office' office:version='1.2'>");
    w.newLine();
    w.write("<office:meta>"); w.newLine();
    
    for (int i = 0; i < items.length - 1; i += 2)
      if (0 != items[i + 1].length())
      {
        w.write("<" + items[i] + ">");
        w.write(items[i + 1]);
        w.write("</" + items[i] + ">");
        w.newLine();
      }
    
    w.write("</office:meta>"); w.newLine();
    w.write("</office:document-meta>");

    w.close();
  }


  /****************************************************************************/
  /* Write the mimetype file. */

  private void writeMimeType () throws IOException
  {
    String filePath = Config.instance().getOutputFolderPath() + "mimetype";
    FileOutputStream f = new FileOutputStream(filePath);
    BufferedWriter w = new BufferedWriter(new OutputStreamWriter(f, "UTF-8"));
    w.write("application/vnd.oasis.opendocument.text"); w.newLine();
    w.close();
    f.close();
  }


  /****************************************************************************/
  /* Write the settings.xml file. */

  private void writeSettingsXml () throws IOException
  {
    String filePath = Config.instance().getOutputFolderPath() + "settings.xml";
    FileOutputStream f = new FileOutputStream(filePath);
    BufferedWriter w = new BufferedWriter(new OutputStreamWriter(f, "UTF-8"));

    w.write("<?xml version='1.0' encoding='UTF-8'?>"); w.newLine();
    w.write("<office:document-settings xmlns:office='urn:oasis:names:tc:opendocument:xmlns:office:1.0' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:meta='urn:oasis:names:tc:opendocument:xmlns:meta:1.0' xmlns:ooo='http://openoffice.org/2004/office' office:version='1.2'>"); w.newLine();
    w.write("<office:settings>"); w.newLine();
    w.write("</office:settings>"); w.newLine();
    w.write("</office:document-settings>");

    w.close();
  }


  /****************************************************************************/
  /* Zip everything up. */

  private void zip () throws IOException
  {
    String outputFolderPath = Config.instance().getOutputFolderPath();
    String zipPath = Config.instance().getZipFilePath();
    Zip zipper = new Zip();
    String thumbnailFile = getThumbnailFile();
    if (0 != thumbnailFile.length()) thumbnailFile = "Thumbnails/" + (new File(thumbnailFile)).getName();
    String[] inputs = {"mimetype¬Store", "content.xml", "styles.xml", "meta.xml¬Store", thumbnailFile, "settings.xml", "META-INF/manifest.xml", "Configurations2", "Pictures"};
    zipper.create(zipPath, 9, outputFolderPath, inputs);
  }


  /****************************************************************************/
  private final String[] C_NotesPrefixInTextFile = {"<br />", "<br />", "<br />"} ;
  private final String[] C_NotesSuffixInTextFile = null;
  private final String C_StartOfMainContent = "<!-- Start trailer block -->";
  private final String C_EndOfMainContent = "<!-- End trailer block -->";

  private int m_AnchorNo = 0;
  private int m_Columns = 1;
  private Stack<ParsedTextOutputter> m_ParsedTextOutputterStack = new Stack<ParsedTextOutputter>();

  
  
  
  
  /****************************************************************************/
  /****************************************************************************/
  /**                                                                        **/
  /**                          File output handling                          **/
  /**                                                                        **/
  /****************************************************************************/
  /****************************************************************************/

  /****************************************************************************/
  /* Used to handle scripture output. */

  private HeaderAndTrailerWriterScripture m_HeaderAndTrailerWriterScripture = new HeaderAndTrailerWriterScripture();
  private class HeaderAndTrailerWriterScripture implements OutputStreamHeaderAndTrailerWriter
  {
    @Override public void writeHeader (MyOutputStream stream) throws IOException
    {
      stream.write("<?xml version='1.0' encoding='UTF-8'?>"); stream.newLine();
      stream.write("<office:document-content office:version='1.0'"); stream.newLine();
      stream.write("  xmlns:chart='urn:oasis:names:tc:opendocument:xmlns:chart:1.0'"); stream.newLine();
      stream.write("  xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:dom='http://www.w3.org/2001/xml-events'"); stream.newLine();
      stream.write("  xmlns:dr3d='urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0'"); stream.newLine();
      stream.write("  xmlns:draw='urn:oasis:names:tc:opendocument:xmlns:drawing:1.0'"); stream.newLine();
      stream.write("  xmlns:fo='urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0'"); stream.newLine();
      stream.write("  xmlns:form='urn:oasis:names:tc:opendocument:xmlns:form:1.0'"); stream.newLine();
      stream.write("  xmlns:math='http://www.w3.org/1998/Math/MathML'"); stream.newLine();
      stream.write("  xmlns:meta='urn:oasis:names:tc:opendocument:xmlns:meta:1.0'"); stream.newLine();
      stream.write("  xmlns:number='urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0'"); stream.newLine();
      stream.write("  xmlns:office='urn:oasis:names:tc:opendocument:xmlns:office:1.0'"); stream.newLine();
      stream.write("  xmlns:ooo='http://openoffice.org/2004/office' xmlns:oooc='http://openoffice.org/2004/calc'"); stream.newLine();
      stream.write("  xmlns:ooow='http://openoffice.org/2004/writer'"); stream.newLine();
      stream.write("  xmlns:script='urn:oasis:names:tc:opendocument:xmlns:script:1.0'"); stream.newLine();
      stream.write("  xmlns:style='urn:oasis:names:tc:opendocument:xmlns:style:1.0'"); stream.newLine();
      stream.write("  xmlns:svg='urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0'"); stream.newLine();
      stream.write("  xmlns:table='urn:oasis:names:tc:opendocument:xmlns:table:1.0'"); stream.newLine();
      stream.write("  xmlns:text='urn:oasis:names:tc:opendocument:xmlns:text:1.0'"); stream.newLine();
      stream.write("  xmlns:xforms='http://www.w3.org/2002/xforms' xmlns:xlink='http://www.w3.org/1999/xlink'"); stream.newLine();
      stream.write("  xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"); stream.newLine();

      // Doesn't work if I put this in styles.xml.  Don't know why.
      stream.write("  <office:automatic-styles>"); stream.newLine();
      stream.write("    <style:style style:name='section-2-columns' style:family='section'>"); stream.newLine();
      stream.write("      <style:section-properties text:dont-balance-text-columns='false' style:editable='false'>"); stream.newLine();
      stream.write("        <style:columns fo:column-count='2' fo:column-gap='30pt'>"); stream.newLine();
      stream.write("          <style:column-sep style:width='0.009cm' style:color='#000000' style:height='100%' style:style='solid'/>"); stream.newLine();
      stream.write("          <style:column style:rel-width='4819*' fo:start-indent='0cm' fo:end-indent='0cm'/>"); stream.newLine();
      stream.write("          <style:column style:rel-width='4819*' fo:start-indent='0cm' fo:end-indent='0cm'/>"); stream.newLine();
      stream.write("        </style:columns>"); stream.newLine();
      stream.write("      </style:section-properties>"); stream.newLine();
      stream.write("    </style:style>"); stream.newLine();
      stream.write("  </office:automatic-styles>"); stream.newLine();
      
      stream.write("  <office:body>"); stream.newLine();
      stream.write("    <office:text>"); stream.newLine();
    }

    @Override public void writeTrailer (MyOutputStream stream) throws IOException
    {
      stream.write("    </office:text>"); stream.newLine();
      stream.write("  </office:body>"); stream.newLine();
      stream.write("</office:document-content>"); stream.newLine();
    }
  }


  /********************************************************************/
  private void outputVerseNumber (int destination,
                                  String prefix,
                                  String suffix,
                                  int low,
                                  String lowLetter,
                                  int high,
                                  String highLetter) throws IOException
  {
    writeToGivenDest(destination, "<text:span text:style-name='verseNumber'>");
    writeToGivenDest(destination, prefix); writeToGivenDest(destination, NumeralProcessor.instance().toVernacular(low)); writeToGivenDest(destination, lowLetter);

    if (low != high)
    {
      writeToGivenDest(destination, Config.instance().getRangeSeparator());
      writeToGivenDest(destination, NumeralProcessor.instance().toVernacular(high));
      writeToGivenDest(destination, highLetter);
    }

    writeToGivenDest(destination, suffix);
    writeToGivenDest(destination, "</text:span>");
  }





  /****************************************************************************/
  /****************************************************************************/
  /**                                                                        **/
  /**                          Specific tag handlers                         **/
  /**                                                                        **/
  /****************************************************************************/
  /****************************************************************************/

  /****************************************************************************/
  /* Generate the appropriate HREF to surround Bible references. */

  private final HrefToBibleReferenceGenerator m_HrefToBibleReferenceGenerator = new HrefToBibleReferenceGenerator();
  private class HrefToBibleReferenceGenerator extends ParsedTextOutputter
  {
    public HrefToBibleReferenceGenerator ()
    {
      setLanguage(BibleReferenceSupport.Language.C_Vernacular);
      setLength(BibleReferenceSupport.Length.C_AsSupplied);
    }
    
    @Override public String toString (ParsedTextElementBibleRef ref,
                                      BibleReferenceSupport.Length fullOrAbbreviated,
                                      BibleReferenceSupport.Language englishOrVernacular,
                                      int sepStyle,
                                      boolean includeDefaultedValues)
    {
      int chapter = ref.getChapterAsInteger(NumeralProcessor.instance());
      boolean followedByRangeSeparator = (-1 != BibleReferenceSupport.instance().isRangeSeparator(ref.getNextSeparatorCode()));
      boolean precededByRangeSeparator = (-1 != BibleReferenceSupport.instance().isRangeSeparator(ref.getPreviousSeparatorCode()));
      boolean targetExists = BookAssembly.instance().
        referenceTargetExists(BibleDetails.instance().getAbbreviatedUbsName_E(ref.getFullEnglishBookName()), chapter);
      
      boolean wantRef = Config.instance().getGenerateLinksForAllScriptureRefs();
      wantRef = wantRef && targetExists;
      
      int bookNo = BibleDetails.instance().getUbsBookNumber_E(ref.getFullEnglishBookName());

      int verse = ref.getVerseAsInteger(NumeralProcessor.instance());
      if (0 == verse) verse = 1;

      String filePrefix =
        getHrefTargetWithinTextFile(bookNo,
                                    chapter,
                                    verse,
                                    ref.getSubverse());

      String s = "";
      if (wantRef && !precededByRangeSeparator) s += "<a href='" + filePrefix + "'>";
      s += ref.toString(fullOrAbbreviated, englishOrVernacular, sepStyle, includeDefaultedValues);
      if (wantRef && !followedByRangeSeparator) s += "</a>";
      
      return s;
    }
  }


  /****************************************************************************/
  /* Generate an href target within the notes file. */

  private String getHrefTargetWithinTextFile (int bookNo,
                                              int chapterNo,
                                              int verseNo,
                                              String subRef)
  {
    String bookName = BookAssembly.instance().getUltimateFileNameForScripture(bookNo, chapterNo);
    return bookName +
           "#v" +
           Integer.toString(bookNo) + "." +
           Integer.toString(chapterNo) + "." +
           Integer.toString(verseNo) +
           (0 == subRef.length() ? "" : "." + subRef);
  }
}
